Parameter documentation stuffs
authorReedy <reedy@wikimedia.org>
Thu, 10 May 2012 07:55:33 +0000 (08:55 +0100)
committerReedy <reedy@wikimedia.org>
Thu, 10 May 2012 23:09:58 +0000 (00:09 +0100)
Change-Id: I2d9e800bf21d420fb26c130d0f271f6739c730a4

includes/filerepo/LocalRepo.php
includes/filerepo/file/LocalFile.php

index 1b8042d..2beea43 100644 (file)
@@ -39,7 +39,7 @@ class LocalRepo extends FileRepo {
        /**
         * @throws MWException
         * @param $row
-        * @return File
+        * @return LocalFile
         */
        function newFileFromRow( $row ) {
                if ( isset( $row->img_name ) ) {
@@ -148,7 +148,7 @@ class LocalRepo extends FileRepo {
        public static function getHashFromKey( $key ) {
                return strtok( $key, '.' );
        }
-       
+
        /**
         * Checks if there is a redirect named as $title
         *
@@ -198,7 +198,6 @@ class LocalRepo extends FileRepo {
                }
        }
 
-
        /**
         * Function link Title::getArticleID().
         * We can't say Title object, what database it should use, so we duplicate that function here.
index e2744b1..6ac6ae4 100644 (file)
@@ -263,6 +263,10 @@ class LocalFile extends File {
                $this->setProps( $props );
        }
 
+       /**
+        * @param $prefix string
+        * @return array
+        */
        function getCacheFields( $prefix = 'img_' ) {
                static $fields = array( 'size', 'width', 'height', 'bits', 'media_type',
                        'major_mime', 'minor_mime', 'metadata', 'timestamp', 'sha1', 'user', 'user_text', 'description' );
@@ -311,6 +315,9 @@ class LocalFile extends File {
        /**
         * Decode a row from the database (either object or array) to an array
         * with timestamps and MIME types decoded, and the field prefix removed.
+        * @param $row
+        * @param $prefix string
+        * @throws MWException
         * @return array
         */
        function decodeRow( $row, $prefix = 'img_' ) {
@@ -488,6 +495,9 @@ class LocalFile extends File {
        /** getPath inherited */
        /** isVisible inhereted */
 
+       /**
+        * @return bool
+        */
        function isMissing() {
                if ( $this->missing === null ) {
                        list( $fileExists ) = $this->repo->fileExists( $this->getVirtualUrl() );
@@ -499,8 +509,8 @@ class LocalFile extends File {
        /**
         * Return the width of the image
         *
-        * Returns false on error
-        * @return bool
+        * @param $page int
+        * @return bool|int Returns false on error
         */
        public function getWidth( $page = 1 ) {
                $this->load();
@@ -520,8 +530,8 @@ class LocalFile extends File {
        /**
         * Return the height of the image
         *
-        * Returns false on error
-        * @return bool
+        * @param $page int
+        * @return bool|int Returns false on error
         */
        public function getHeight( $page = 1 ) {
                $this->load();
@@ -542,6 +552,7 @@ class LocalFile extends File {
         * Returns ID or name of user who uploaded the file
         *
         * @param $type string 'text' or 'id'
+        * @return int|string
         */
        function getUser( $type = 'text' ) {
                $this->load();
@@ -562,6 +573,9 @@ class LocalFile extends File {
                return $this->metadata;
        }
 
+       /**
+        * @return int
+        */
        function getBitDepth() {
                $this->load();
                return $this->bits;
@@ -569,6 +583,7 @@ class LocalFile extends File {
 
        /**
         * Return the size of the image file, in bytes
+        * @return int
         */
        public function getSize() {
                $this->load();
@@ -577,6 +592,7 @@ class LocalFile extends File {
 
        /**
         * Returns the mime type of the file.
+        * @return string
         */
        function getMimeType() {
                $this->load();
@@ -586,6 +602,7 @@ class LocalFile extends File {
        /**
         * Return the type of the media in the file.
         * Use the value returned by this function with the MEDIATYPE_xxx constants.
+        * @return string
         */
        function getMediaType() {
                $this->load();
@@ -800,6 +817,13 @@ class LocalFile extends File {
        /** purgeDescription inherited */
        /** purgeEverything inherited */
 
+       /**
+        * @param $limit null
+        * @param $start null
+        * @param $end null
+        * @param $inc bool
+        * @return array
+        */
        function getHistory( $limit = null, $start = null, $end = null, $inc = true ) {
                $dbr = $this->repo->getSlaveDB();
                $tables = array( 'oldimage' );
@@ -918,12 +942,12 @@ class LocalFile extends File {
         * @param $comment String: upload description
         * @param $pageText String: text to use for the new description page,
         *                  if a new description page is created
-        * @param $flags Integer: flags for publish()
-        * @param $props Array: File properties, if known. This can be used to reduce the
+        * @param $flags Integer|bool: flags for publish()
+        * @param $props Array|bool: File properties, if known. This can be used to reduce the
         *               upload time when uploading virtual URLs for which the file info
         *               is already known
-        * @param $timestamp String: timestamp for img_timestamp, or false to use the current time
-        * @param $user Mixed: User object or null to use $wgUser
+        * @param $timestamp String|bool: timestamp for img_timestamp, or false to use the current time
+        * @param $user User|null: User object or null to use $wgUser
         *
         * @return FileRepoStatus object. On success, the value member contains the
         *     archive name, or an empty string if it was a new file.
@@ -957,6 +981,13 @@ class LocalFile extends File {
 
        /**
         * Record a file upload in the upload log and the image table
+        * @param $oldver
+        * @param $desc string
+        * @param $license string
+        * @param $copyStatus string
+        * @param $source string
+        * @param $watch bool
+        * @param $timestamp string|bool
         * @return bool
         */
        function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '',
@@ -977,6 +1008,12 @@ class LocalFile extends File {
 
        /**
         * Record a file upload in the upload log and the image table
+        * @param $oldver
+        * @param $comment string
+        * @param $pageText string
+        * @param $props bool|array
+        * @param $timestamp bool|string
+        * @param $user null|User
         * @return bool
         */
        function recordUpload2(
@@ -1403,16 +1440,25 @@ class LocalFile extends File {
                return $pout->getText();
        }
 
+       /**
+        * @return string
+        */
        function getDescription() {
                $this->load();
                return $this->description;
        }
 
+       /**
+        * @return bool|string
+        */
        function getTimestamp() {
                $this->load();
                return $this->timestamp;
        }
 
+       /**
+        * @return string
+        */
        function getSha1() {
                $this->load();
                // Initialise now if necessary
@@ -1435,6 +1481,9 @@ class LocalFile extends File {
                return $this->sha1;
        }
 
+       /**
+        * @return bool
+        */
        function isCacheable() {
                $this->load();
                return strlen( $this->metadata ) <= self::CACHE_FIELD_MAX_LEN; // avoid OOMs
@@ -1505,6 +1554,11 @@ class LocalFileDeleteBatch {
        var $reason, $srcRels = array(), $archiveUrls = array(), $deletionBatch, $suppress;
        var $status;
 
+       /**
+        * @param $file File
+        * @param $reason string
+        * @param $suppress bool
+        */
        function __construct( File $file, $reason = '', $suppress = false ) {
                $this->file = $file;
                $this->reason = $reason;
@@ -1516,6 +1570,9 @@ class LocalFileDeleteBatch {
                $this->srcRels['.'] = $this->file->getRel();
        }
 
+       /**
+        * @param $oldName string
+        */
        function addOld( $oldName ) {
                $this->srcRels[$oldName] = $this->file->getArchiveRel( $oldName );
                $this->archiveUrls[] = $this->file->getArchiveUrl( $oldName );
@@ -1543,6 +1600,9 @@ class LocalFileDeleteBatch {
                return $archiveNames;
        }
 
+       /**
+        * @return array
+        */
        function getOldRels() {
                if ( !isset( $this->srcRels['.'] ) ) {
                        $oldRels =& $this->srcRels;
@@ -1556,6 +1616,9 @@ class LocalFileDeleteBatch {
                return array( $oldRels, $deleteCurrent );
        }
 
+       /**
+        * @return array
+        */
        protected function getHashes() {
                $hashes = array();
                list( $oldRels, $deleteCurrent ) = $this->getOldRels();
@@ -1796,6 +1859,7 @@ class LocalFileDeleteBatch {
 
        /**
         * Removes non-existent files from a deletion batch.
+        * @param $batch array
         * @return array
         */
        function removeNonexistentFiles( $batch ) {
@@ -1832,6 +1896,10 @@ class LocalFileRestoreBatch {
 
        var $cleanupBatch, $ids, $all, $unsuppress = false;
 
+       /**
+        * @param $file File
+        * @param $unsuppress bool
+        */
        function __construct( File $file, $unsuppress = false ) {
                $this->file = $file;
                $this->cleanupBatch = $this->ids = array();
@@ -2087,12 +2155,14 @@ class LocalFileRestoreBatch {
 
        /**
         * Removes non-existent files from a store batch.
+        * @param $triplets array
         * @return array
         */
        function removeNonexistentFiles( $triplets ) {
                $files = $filteredTriplets = array();
-               foreach ( $triplets as $file )
+               foreach ( $triplets as $file ) {
                        $files[$file[0]] = $file[0];
+               }
 
                $result = $this->file->repo->fileExistsBatch( $files );
 
@@ -2107,6 +2177,7 @@ class LocalFileRestoreBatch {
 
        /**
         * Removes non-existent files from a cleanup batch.
+        * @param $batch array
         * @return array
         */
        function removeNonexistentFromCleanup( $batch ) {
@@ -2186,8 +2257,17 @@ class LocalFileMoveBatch {
         */
        var $target;
 
-       var $cur, $olds, $oldCount, $archive, $db;
+       var $cur, $olds, $oldCount, $archive;
 
+       /**
+        * @var DatabaseBase
+        */
+       var $db;
+
+       /**
+        * @param File $file
+        * @param Title $target
+        */
        function __construct( File $file, Title $target ) {
                $this->file = $file;
                $this->target = $target;
@@ -2197,7 +2277,7 @@ class LocalFileMoveBatch {
                $this->newName = $this->file->repo->getNameFromTitle( $this->target );
                $this->oldRel = $this->oldHash . $this->oldName;
                $this->newRel = $this->newHash . $this->newName;
-               $this->db = $file->repo->getMasterDb();
+               $this->db = $file->getRepo()->getMasterDb();
        }
 
        /**
@@ -2371,6 +2451,7 @@ class LocalFileMoveBatch {
 
        /**
         * Removes non-existent files from move batch.
+        * @param $triplets array
         * @return array
         */
        function removeNonexistentFiles( $triplets ) {